<template>
  <h1>测试窗口关闭 此窗口退出程序</h1>
  <!-- <video autoplay></video> -->
  <!-- <nav>
    <router-link to="/">Home</router-link> |
    <router-link to="/about">About</router-link>
  </nav>
  <router-view /> -->
</template>
<script setup>
// import { nextTick, onMounted } from "vue";

// onMounted(() => {
//   nextTick(() => {
//     getMediaStream();
//   });
//   const constraints = {
//     video: {
//       // 640*480
//       width: { ideal: 640 * 2 },
//       height: { ideal: 480 * 2 },
//     },
//   };
//   async function getMediaStream() {
//     try {
//       const stream = await navigator.mediaDevices.getUserMedia(constraints);
//       const videoElement = document.querySelector("video");
//       videoElement.srcObject = stream;
//       // 等待 metadata 加载完成再进行绘制
//       await new Promise((resolve) => {
//         videoElement.addEventListener("loadedmetadata", resolve);
//       });
//       // 获取摄像头流的设置
//       const track = stream.getVideoTracks()[0];
//       const settings = track.getSettings();
//       console.log(
//         `摄像头宽度：${settings.width}，摄像头高度：${settings.height}`
//       );
//       // 检查摄像头是否支持所需分辨率
//       const capabilities = track.getCapabilities();
//       console.log(capabilities);
//     } catch (err) {
//       console.error(err);
//     }
//   }
// });
</script>

<style lang="scss">
html,
body {
  padding: 0;
  margin: 0;
}
video {
  display: flex;
  width: 100vw;
  height: 100vh;
  transform: scaleX(-1);
  -webkit-app-region: drag;
}
</style>
